<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <!-- <script>
            let money = 100;
            while (true) {
                alert("欢迎使用本次服务：\n1.存钱\n2.取钱\n3.查看余额\n4.退出");
                let getInputOrdinal = Number(
                    window.parseInt(prompt("请输入选项："))
                );
                if (getInputOrdinal === 1) {
                    let getDeposit = Number(
                        window.parseInt(
                            prompt("请输入要存的金额\n（只允许输入整数）")
                        )
                    );
                    money += getDeposit;
                } else if (getInputOrdinal === 2) {
                    let getAmount = Number(
                        window.parseInt(
                            prompt("请输入要取的金额\n（只允许输入整数）")
                        )
                    );
                    let smtp = 0;
                    if (getAmount < money) {
                        money -= getAmount;
                        smtp = money;
                        alert("谢谢使用");
                    } else if (getAmount > money) {
                        alert("超支！");
                    }
                    money = smtp;
                } else if (getInputOrdinal === 3) {
                    alert(money + "￥");
                } else if (getInputOrdinal == 4) {
                    alert("已退出");
                    break;
                }
            }
        </script> -->
        <script>
            let money = localStorage.setItem("money", 100);
            while (true) {
                alert("欢迎使用本次服务：\n1.存钱\n2.取钱\n3.查看余额\n4.退出");
                let getInputOrdinal = Number(
                    window.parseInt(prompt("请输入选项："))
                );
                money = Number(localStorage.setItem("money", getInputOrdinal));
                if (getInputOrdinal === 1) {
                    let getDeposit = Number(
                        window.parseInt(
                            prompt("请输入要存的金额\n（只允许输入整数）")
                        )
                    );
                    money =Number( localStorage.setItem("money", getDeposit))
                    money += getDeposit;
                } else if (getInputOrdinal === 2) {
                    let getAmount = Number(
                        window.parseInt(
                            prompt("请输入要取的金额\n（只允许输入整数）")
                        )
                    );
                    if (getAmount < money) {
                        money -= getAmount;
                        alert("谢谢使用");
                    } else if (getAmount > money) {
                        alert("超支！");
                    }
                } else if (getInputOrdinal === 3) {
                    alert(money + "￥");
                } else if (getInputOrdinal == 4) {
                    alert("已退出");
                    break;
                }
            }
        </script>
    </body>
</html>
